package com.yintao.ytframe.base.design.factory.dest.impl;

import com.yintao.ytframe.base.design.factory.dest.IAwardService;
import com.yintao.ytframe.base.design.factory.normal.bo.AwardReq;
import com.yintao.ytframe.base.design.factory.normal.bo.AwardRes;
import com.yintao.ytframe.base.design.factory.normal.bo.DeliverReq;
import com.yintao.ytframe.base.design.factory.normal.rpc.AiqiyRpcService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

/**
 * @Description
 * @Author yintao12
 * @Date 2021/1/4 20:29
 * @Doc
 **/
public class AiqiyAwardServiceImpl implements IAwardService {

    private static final Logger log = LoggerFactory.getLogger(AiqiyAwardServiceImpl.class);

    private AiqiyRpcService aiqiyRpcService = new AiqiyRpcService();

    public AwardRes awardUser(String uid, String couponNumber, String uuid, Map<String, String> extMap) {
        //组装参数
        log.info("AiqiyAwardServiceImpl -> awardUser start, uid={}, couponNumber={}, uuid={}, extMap={}", uid, couponNumber, uuid, extMap);
        aiqiyRpcService.grantToken(uid, queryUserPhone(uid), extMap.get("uuid"));
        log.info("AiqiyAwardServiceImpl -> awardUser grantToken end");
        return AwardRes.buildSuccessMsg();
    }

    private String queryUserPhone(String uid) {
        return "135234233";
    }

}
